package com.wn.servlet.resp;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;

/**
 * @author yellow Docter
 * @date 2022 -06-29
 * @desc
 *
 */
@WebServlet("/resp02")
public class Resp02Servlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        System.out.println("我没有钱你去 找resp03");

        // 写路径转发到 resp03
        // /项目访问路径/资源路径
//        resp.sendRedirect("/day03/resp03");

        // 可以跳转到 其他的地方
        resp.sendRedirect("http://www.jd.com");

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
